package com.xdtech.${moduleName}.vo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.sql.Timestamp;

import com.xdtech.core.orm.utils.BeanUtils;
import com.xdtech.${moduleName}.model.${modelName?cap_first};

import com.xdtech.web.freemark.item.GridColumn;

/**
 * 
 * @author max.zheng
 * @create ${createTime}
 * @since 1.0
 * @see
 */
public class ${modelName?cap_first}Item implements Serializable{
	private static final long serialVersionUID = 1L;
<#list fields as field>
	<#if field.name='id'>
	<#else>
	@GridColumn(title="${field.showName}",width=100)
	</#if>
	<#if field.type='Date'>
	private String ${field.name};
	<#else>
	private ${field.type} ${field.name};
	</#if>
</#list>

<#list fields as field>
	<#if field.type='Date'>
	public void set${field.name?cap_first}(String ${field.name}) {
		this.${field.name} = ${field.name};
	}
	public String get${field.name?cap_first}() {
		return ${field.name};
	}
	<#else>
	public void set${field.name?cap_first}(${field.type} ${field.name}) {
		this.${field.name} = ${field.name};
	}
	public ${field.type} get${field.name?cap_first}() {
		return ${field.name};
	}
	</#if>
	
</#list>
	/**
	 * 根据model构建vo
	 * 
	 * @author max
	 * @return
	 */
	public static ${modelName?cap_first}Item createItem(${modelName?cap_first} ${modelName}) {
		${modelName?cap_first}Item ${modelName}Item = new ${modelName?cap_first}Item();
		BeanUtils.copyProperties(${modelName}Item, ${modelName});
		//自定义属性设置填充
		return ${modelName}Item;
	}
	/**
	 * 根据model集合创建vo集合
	 * 
	 * @author max
	 * @return
	 */
	public static List<${modelName?cap_first}Item> createItems(List<${modelName?cap_first}> ${modelName}s) {
		List<${modelName?cap_first}Item> ${modelName}Items = new ArrayList<${modelName?cap_first}Item>();
		for (${modelName?cap_first} ${modelName} : ${modelName}s) {
			${modelName}Items.add(createItem(${modelName}));
		}
		return ${modelName}Items;
	}
}
